package com.thx.appserver.dao;

import java.util.List;

import org.hibernate.transform.Transformers;
import org.springframework.stereotype.Repository;

import com.thx.appserver.model.CappOpinion;
import com.thx.common.orm.PaginationDao;


@Repository
public class CappOpinionDao extends PaginationDao<CappOpinion> {

	public List<CappOpinion> searchOpinion(CappOpinion opinion) {
		String hql = "from CappOpinion where 1=1 ";
		if (!"".equals(opinion.getOpinionType()) && null !=opinion.getOpinionType()) {
			hql += " and opinionType = '" + opinion.getOpinionType() + "'";
		}
		hql += " order by opinionId desc";
		return findPageList(hql);
	}

	/*
	 * 返回意见反馈的意见下拉列表
	 */
	@SuppressWarnings("unchecked")
	public List<Object> getOpinion(){
		String sql = "select * from (select distinct opinion_type from capp_opinion) a where a.opinion_type is not null";
		return createSqlQuery(sql).list();

	}

}
